#include "rwnx_utils.h"
#include "system.h"

typedef struct {
    uint8_t aic_tkip_conf;
    uint8_t send_bar;
    uint8_t new_backoff_bw_rise_en;
    uint8_t wdt_en;
} wifi_feature_param_t;

typedef struct {
    uint8_t  beacon_linkloss_thd;
    uint8_t  ps_tx_error_max;
    uint16_t bam_inactivity_to_duration;
    uint32_t mm_keep_alive_period;
    uint32_t default_assocrsp_timeout;
    uint32_t default_authrsp_timeout;
    uint32_t scan_active_duration;
    uint32_t scan_passive_duration;
    uint32_t tx_ac0_timeout;
    uint32_t tx_ac1_timeout;
    uint32_t tx_ac2_timeout;
    uint32_t tx_ac3_timeout;
    uint32_t tx_bcn_timeout;
    uint32_t tx_hiq_timeout;
    uint16_t sdio_rx_buf_num_threshold;
    uint16_t sdio_rx_buf_rep_threshold;
    uint16_t deepsleep_notallowed_offset;
    uint16_t ps_activity_to_us;
    uint16_t ps_activity_bcmc_to_us;
    uint16_t ps_activity_uc_to_us;
    uint16_t lp_wakeup_offset;
    uint8_t  tx_he_tb_prog_time;
    uint8_t  tx_agg_finish_dur;
} thresh_param_t;

typedef struct {
    uint8_t host_type;
    uint16_t sdio_desc_cnt;
    uint16_t pkt_cnt_128;
    uint16_t pkt_cnt_1600;
    uint16_t pkt_cnt_1724;
    uint32_t ipc_base_addr;
    uint32_t buf_base_addr;
    uint32_t desc_base_addr;
    uint32_t desc_size;
    uint32_t pkt_base_addr;
    uint32_t pkt_size;
    uint32_t txdesc_cnt[5];
    uint32_t reord_buf_size;
} host_if_param_t;

typedef struct {
    uint32_t rx_ringbuf_start1;
    uint32_t rx_ringbuf_size1;
    uint32_t rx_ringbuf_start2;
    uint32_t rx_ringbuf_size2;
} rx_ringbuf_conf_t;

typedef struct {
    uint32_t ac_param[4];
} ac_param_conf_t;

typedef struct {
    uint8_t fix_txgain_en;
    uint8_t fix_txgain_val;
    uint8_t fix_txgain_val_5g;
    uint8_t fix_1024qam_txgain;
} txgain_conf_t;

typedef struct {
    wifi_feature_param_t wifi_feature_param;
    thresh_param_t thresh_param;
    host_if_param_t host_if_param;
    rx_ringbuf_conf_t rx_ringbuf_conf;
    ac_param_conf_t ac_param_conf;
    uint32_t clkgate_en_config;
    uint32_t uart_config;
    uint8_t lp_level;
    uint8_t bt_use_wifi_rf;
    uint16_t debug_mask;
    txgain_conf_t txgain_config;
    uint16_t pwr_close_sysdelay;
    uint16_t pwr_open_sysdelay;
    uint8_t use_5g;
    uint8_t clkgate_use_hwbcn;
    uint8_t poweroff_use_hwbcn;
    #if (CFG_ROM_VER >= 3)
    //append configuration for u03
    uint8_t fix_txgain_val_24g_11b;
    uint8_t sdio_send_ampdu;
    uint8_t sdio_send_ampdu_blkcnt_thresh;
    #endif
} wifi_settings_t;

#define JUMP_TABLE_BASE_U02     0x00171A30
#define KE_EVT_HDLR_BASE_U02    0x001720C4
#define JUMP_TABLE_BASE_U03     0x00171A3C
#define KE_EVT_HDLR_BASE_U03    0x001720E0

#define JUMP_TABLE_BASEx(v)     MCAT(JUMP_TABLE_BASE_U0, v)
#define JUMP_TABLE_BASE         JUMP_TABLE_BASEx(CFG_ROM_VER)
#define KE_EVT_HDLR_BASEx(v)    MCAT(KE_EVT_HDLR_BASE_U0, v)
#define KE_EVT_HDLR_BASE        KE_EVT_HDLR_BASEx(CFG_ROM_VER)

#define WIFI_SETTINGS_OFST(mem) (((uint32_t) &((wifi_settings_t *)0)->mem) & ~0x03UL)
#define JUMP_TABLE_OFSTx(i,v)   ((uint32_t)(MCAT(JUMP_TABLE_BASE_U0, v)+(i)*4))
#define JUMP_TABLE_OFST(i)      JUMP_TABLE_OFSTx(i, CFG_ROM_VER)
#define KE_EVT_HDLR_OFSTx(i,v)  ((uint32_t)(MCAT(KE_EVT_HDLR_BASE_U0, v)+(i)*8))
#define KE_EVT_HDLR_OFST(i)     KE_EVT_HDLR_OFSTx(i, CFG_ROM_VER)

uint32_t VAR_WITH_VERx(patch_tbl, 2)[][2] =
{
    {WIFI_SETTINGS_OFST(thresh_param.lp_wakeup_offset), 0x080503e8}, // .lp_wakeup_offset = 1000, .tx_he_tb_prog_time = 5, .tx_agg_finish_dur = 8
    {WIFI_SETTINGS_OFST(host_if_param.host_type),       0x00000003}, // .host_type = 3,.sdio_desc_cnt = 0
    {WIFI_SETTINGS_OFST(host_if_param.pkt_cnt_128),     0x00000000}, // .pkt_cnt_128, .pkt_cnt_1600 = 0
    #if PLF_WIFI_AUDIO
    #ifdef CFG_SOFTAP
    {WIFI_SETTINGS_OFST(host_if_param.pkt_cnt_1724),    0x00000011},
    #else
    {WIFI_SETTINGS_OFST(host_if_param.pkt_cnt_1724),    0x00000011},
    #endif
    #else
    {WIFI_SETTINGS_OFST(host_if_param.pkt_cnt_1724),    0x00000011},
    #endif
    {WIFI_SETTINGS_OFST(host_if_param.buf_base_addr),   0x00000000},
    {WIFI_SETTINGS_OFST(host_if_param.desc_base_addr),  0x00000000},
    {WIFI_SETTINGS_OFST(host_if_param.desc_size),       0x00000000},
    {WIFI_SETTINGS_OFST(host_if_param.pkt_size),        0x00007800},
    #if (PLF_BT_STACK || PLF_BLE_STACK) && (PLF_WIFI_STACK)
    {WIFI_SETTINGS_OFST(host_if_param.ipc_base_addr),   0x00190000},
    {WIFI_SETTINGS_OFST(host_if_param.pkt_base_addr),   0x00190800},
    #else
    {WIFI_SETTINGS_OFST(host_if_param.ipc_base_addr),   0x00190000},
    {WIFI_SETTINGS_OFST(host_if_param.pkt_base_addr),   0x00190800},
    #endif
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[0]),   NX_TXDESC_CNT0},
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[1]),   NX_TXDESC_CNT1},
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[2]),   NX_TXDESC_CNT2},
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[3]),   NX_TXDESC_CNT3},
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[4]),   NX_TXDESC_CNT4},
    {WIFI_SETTINGS_OFST(host_if_param.reord_buf_size),  NX_REORD_BUF_SIZE},
    {WIFI_SETTINGS_OFST(rx_ringbuf_conf.rx_ringbuf_start1), 0x00000000},
    {WIFI_SETTINGS_OFST(rx_ringbuf_conf.rx_ringbuf_start2), 0x00000000},
    #if FRAMES_11MBPS_ENABLED
    #if defined(CFG_WIFI_VOICE_ROLE_DONGLE)
    {WIFI_SETTINGS_OFST(thresh_param.tx_ac0_timeout),   40000}, // 40ms
    {WIFI_SETTINGS_OFST(thresh_param.tx_ac1_timeout),   40000}, // 40ms
    {WIFI_SETTINGS_OFST(thresh_param.tx_ac2_timeout),   40000}, // 40ms
    {WIFI_SETTINGS_OFST(thresh_param.tx_ac3_timeout),   40000}, // 40ms
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[0]),     0x00000a47},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[1]),     0x00000643},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[2]),     0x0005e431},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[3]),     0x0002f321},
    #else
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[0]),     0x00000000},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[1]),     0x00000000},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[2]),     0x00000000},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[3]),     0x00000000},
    #endif
    #endif /* FRAMES_11MBPS_ENABLED */
#if CONFIG_SLEEP_LEVEL == 0
    {WIFI_SETTINGS_OFST(lp_level), 0x8d0a0000}, // .lp_level = 0, .bt_use_wifi_rf = 0, .debug_mask=0x8d0a
#elif CONFIG_SLEEP_LEVEL == 1
    {WIFI_SETTINGS_OFST(lp_level), 0xffff0001}, // .lp_level = 1, .bt_use_wifi_rf = 0, .debug_mask=0xffff
#elif CONFIG_SLEEP_LEVEL >= 2
    {WIFI_SETTINGS_OFST(lp_level), 0xffff0002}, // .lp_level = 2, .bt_use_wifi_rf = 0, .debug_mask=0xffff
#endif
    #if PLF_BAND5G
    // Attention, GPIOs used by 5g fem maybe conflict with audio I2SM.
    {WIFI_SETTINGS_OFST(txgain_config.fix_txgain_en),   0xd0e0d003}, // .fix_txgain_en = 3, .fix_txgain_val = 0xd0, .fix_txgain_val_5g = 0xe0, .fix_1024qam_txgain = 0xd0
    {WIFI_SETTINGS_OFST(use_5g),                        0x00010001}, // .use_5g = 1, .clkgate_use_hwbcn = 0, .poweroff_use_hwbcn = 1
    #else
    {WIFI_SETTINGS_OFST(txgain_config.fix_txgain_en),   0xd0e0f301}, // .fix_txgain_en = 1, .fix_txgain_val = 0xf3, .fix_txgain_val_5g = 0xe0, .fix_1024qam_txgain = 0xd0
    #endif
};

uint32_t VAR_WITH_VERx(patch_tbl_func, 2)[][2] =
{
    { JUMP_TABLE_OFSTx( 53, 2), 0x001cebdd }, //hal_machw_abs_timer_handler_patch
    { JUMP_TABLE_OFSTx( 86, 2), 0x001ce10d }, //me_build_associate_req_patch
    { JUMP_TABLE_OFSTx(136, 2), 0x001ce531 }, //phy_get_rf_gain_idx_patch
    { JUMP_TABLE_OFSTx(171, 2), 0x001ce595 }, //rxl_payload_transfer_patch
    { JUMP_TABLE_OFSTx(297, 2), 0x001ce6ad }, //phy_rf_add_config_24g_patch
    { JUMP_TABLE_OFSTx(299, 2), 0x001ce6bd }, //phy_rf_add_config_5g_patch
    { KE_EVT_HDLR_OFSTx( 0, 2), 0x001ce77d }, //rwnxl_reset_evt_patch
    { JUMP_TABLE_OFSTx(106, 2), 0x001ce929 }, //mm_init_patch
    { JUMP_TABLE_OFSTx(154, 2), 0x001ced15 }, //rc_check_patch
    { JUMP_TABLE_OFSTx( 97, 2), 0x001cee95 }, //mm_bcn_transmit
    { JUMP_TABLE_OFSTx( 98, 2), 0x001cefd9 }, //mm_bcn_transmitted
};

uint32_t VAR_WITH_VERx(patch_func, 2)[] =
{
    0x4a0f480e,
    0x490f6803,
    0x03fff023,
    0x03c2f043,
    0x68136003,
    0x03fff023,
    0x03c2f043,
    0x68036013,
    0x237ff423,
    0x233ff443,
    0x68136003,
    0x237ff423,
    0x233ff443,
    0x601320c2,
    0x477071c8,
    0x4033b3ac,
    0x4033b3d4,
    0x001cf174,
    0x61647075,
    0x20236574,
    0x2064253d,
    0x0a0d6425,
    0x00000000,
    0x48254b24,
    0xe92d681b,
    0x4d2441f0,
    0x796a4f24,
    0x1007f995,
    0x4e23683c,
    0x030ff003,
    0xb252441a,
    0xf06f1a89,
    0x4299033d,
    0x4619bfb8,
    0xfc81fa5f,
    0x04fff024,
    0x040cea44,
    0x6833603c,
    0x03fff023,
    0x030cea43,
    0x683c6033,
    0xfa5f1ecb,
    0xf424fc83,
    0xea44247f,
    0x603c340c,
    0xf4236833,
    0xb24c237f,
    0x330cea43,
    0x46216033,
    0xf66171ec,
    0x343df8e5,
    0x4b0ddb0e,
    0x691a8929,
    0xf2474b0c,
    0xf1055430,
    0xfb04000c,
    0xf8d32101,
    0xe8bd31e0,
    0x471841f0,
    0x81f0e8bd,
    0x4032011c,
    0x001ce048,
    0x001cf174,
    0x4033b3ac,
    0x4033b3d4,
    0x40501000,
    0x00171a30,
    0x4ff0e92d,
    0x460db08f,
    0x8f3c9f1a,
    0x8036f8b7,
    0x2c004601,
    0xbf084618,
    0x46162405,
    0xf6639107,
    0xf8b5fda9,
    0x9b0790ae,
    0x0910f009,
    0x0009ea40,
    0x0240f107,
    0x9202805c,
    0xfa1f8018,
    0x4614f980,
    0xf0002e00,
    0x883281d9,
    0x8872809a,
    0x88b280da,
    0x220a811a,
    0x98184616,
    0x60011899,
    0x0c00f04f,
    0x007ef895,
    0xf8039107,
    0x9b07c002,
    0x0e02f100,
    0x28007058,
    0x80bcf040,
    0xf8959907,
    0xeb0e20b0,
    0x23010001,
    0xf80e9007,
    0x9b073001,
    0x46942a08,
    0xf04fbf28,
    0xf8830c08,
    0x9907c001,
    0xfe8efa1f,
    0x0a02f10c,
    0x03b1f105,
    0xf10cb152,
    0x44ac0cb1,
    0x0b01f813,
    0x1b52185a,
    0xf802459c,
    0xd1f70cb0,
    0x20b0f895,
    0xeb0a44d6,
    0x2a080301,
    0x93074476,
    0x2332d91b,
    0x3001f80a,
    0xf1a29b07,
    0x70590108,
    0x0cb1f102,
    0x44ac9907,
    0x0e06f1a2,
    0x03b9f105,
    0x0b01f813,
    0x1b52185a,
    0xf802459c,
    0xd1f70cb8,
    0x0301eb0e,
    0x93074476,
    0xf419b2b6,
    0xd17d7f80,
    0x0f00f1b8,
    0x9a02d00b,
    0x46104442,
    0x0240f1a4,
    0x1b01f814,
    0x42841bd2,
    0xd1f754d1,
    0xf8d59b07,
    0x444640e0,
    0x07e24443,
    0x9307b2b6,
    0x4ab4d51a,
    0xaf0aca07,
    0x2000c703,
    0x803aa90a,
    0x0036f8ad,
    0x0032f8cd,
    0x0030f88d,
    0xa80c1a5b,
    0xe00122dd,
    0x2f01f811,
    0x4288545a,
    0x9b07d1fa,
    0x33093609,
    0x9307b2b6,
    0xd50507a7,
    0xf8934ba6,
    0x07dc3176,
    0x80daf100,
    0x7d9b4ba4,
    0xf0002b01,
    0xf8d580e1,
    0x071830e0,
    0x4a9fd505,
    0x2176f892,
    0xf1000751,
    0x075a80c1,
    0x4d9bd51a,
    0x3176f895,
    0xd515079b,
    0xa8074c9a,
    0x3150f8d4,
    0x44064798,
    0xf8d48f28,
    0xf663714c,
    0xf895fb8b,
    0x2a042175,
    0xbf084601,
    0xa8072203,
    0xb2b647b8,
    0xb2864430,
    0x681a9b18,
    0x1a9b9b07,
    0x46309a19,
    0xb00f8013,
    0x8ff0e8bd,
    0x9907307f,
    0xf1054428,
    0xf813037f,
    0x185acb01,
    0x42981b52,
    0xcc7ef802,
    0xe736d1f7,
    0x22211c59,
    0x701a9107,
    0x22029b07,
    0x91071c59,
    0x701aa80a,
    0x0127f10d,
    0xff8ef642,
    0x30a4f8d5,
    0x2028f99d,
    0x3004f993,
    0xbfc8429a,
    0x3028f88d,
    0xf89d9b07,
    0x1c592027,
    0x701a9107,
    0xf89d9b07,
    0x1c592028,
    0x701a9107,
    0x22249b07,
    0x91071c59,
    0x9b07701a,
    0x461a9303,
    0x0b01f102,
    0x30a4f8d5,
    0xb01cf8cd,
    0x4a68789b,
    0xf0402b00,
    0x23018083,
    0xa172f892,
    0x32769304,
    0x0f00f1ba,
    0x80bcf000,
    0x95062100,
    0x46089101,
    0x9605468e,
    0x460d46a1,
    0xf01378d3,
    0xd1200302,
    0xf8b27894,
    0x2c00c000,
    0xf6acd173,
    0x2c48146c,
    0xf640d86a,
    0x459c13b4,
    0x809ff000,
    0xf6ac4c57,
    0xfba41367,
    0x089c4303,
    0x0387f3c3,
    0xd0742800,
    0x0e0eeba4,
    0x45a69c04,
    0x3001d173,
    0x469eb2c0,
    0x31013206,
    0x459ab2cb,
    0x9b01d8d6,
    0xf1039e05,
    0x46290e02,
    0xf38efa5f,
    0x464c9d06,
    0xf10b469e,
    0x92070201,
    0x1000f88b,
    0x1c519a07,
    0x70109107,
    0x36069a03,
    0xfa1e7013,
    0x9b07f686,
    0xe6f5b2b6,
    0xa8074b3d,
    0x3144f8d3,
    0x44064798,
    0x30e0f8d5,
    0xe734b2b6,
    0xa8074b38,
    0x3148f8d3,
    0x4b354798,
    0x44067d9b,
    0xb2b62b01,
    0xaf1ff47f,
    0x30e4f8b5,
    0xf43f2b00,
    0x9b07af1a,
    0x701a2236,
    0x22039b07,
    0x9b07705a,
    0x20e4f8b5,
    0xf895805a,
    0x711a20e6,
    0x36059b07,
    0xb2b63305,
    0xe7069307,
    0xf8922304,
    0x9304a173,
    0xe77b32ca,
    0x4686b9d8,
    0x20014605,
    0x2c01e7a6,
    0xf5acd1f8,
    0xf1ac5c9c,
    0xb2a4040d,
    0x7f4df5b4,
    0x4b1dd8f0,
    0x0c08f1ac,
    0x430cfba3,
    0xf3c3089c,
    0x28000387,
    0x469ed18a,
    0x2001461d,
    0xf10be78e,
    0x94070401,
    0x5000f88b,
    0x9e019c07,
    0x0c01f104,
    0x0e02f106,
    0xc01cf8cd,
    0x0c02f100,
    0xfa5f7020,
    0x9001f08e,
    0xb01cf8dd,
    0xfa5f469e,
    0xe775f08c,
    0x46162204,
    0x230ee62b,
    0xe765461c,
    0x46502302,
    0x469e4651,
    0xbf00e779,
    0x001cf0fc,
    0x0017a804,
    0x0017a984,
    0x00171a30,
    0xcccccccd,
    0xf8934b0c,
    0xb953302a,
    0xf8934b0b,
    0x07c000ac,
    0xf893d50e,
    0x700b30ad,
    0x701323e6,
    0x4b064770,
    0x00acf893,
    0xd5030780,
    0x30aef893,
    0x7013700b,
    0xbf004770,
    0x00173164,
    0x0017192c,
    0x5f6c7872,
    0x6c796170,
    0x5f64616f,
    0x6e617274,
    0x72656673,
    0x7461705f,
    0x00006863,
    0x21206470,
    0x554e203d,
    0x00004c4c,
    0x4ff0e92d,
    0x68074c3e,
    0x881d6824,
    0xc000f894,
    0xb100f8df,
    0xf5b1b083,
    0x9e0c6fc8,
    0xeb069301,
    0xbf280646,
    0x61c8f44f,
    0x0f03f1bc,
    0x4b35bf08,
    0xeb079000,
    0xf1061606,
    0x46900614,
    0x601ebf08,
    0xe02d2000,
    0x0403ebae,
    0x440c442c,
    0xb2a41b52,
    0x2500b291,
    0x0f03f1bc,
    0xf5b1d10d,
    0x460b6f00,
    0xf44fbf28,
    0xf0436300,
    0xf04f4323,
    0x60b31204,
    0x613160f1,
    0x44886172,
    0xf8dbb3ac,
    0xf8d73000,
    0xf9b39004,
    0x2b003000,
    0x0a14f109,
    0xf1bcdb1b,
    0xd1010f03,
    0xa020f8c6,
    0x46564638,
    0x4621464f,
    0x4302e9d7,
    0xfa1f3301,
    0xb29bfe84,
    0x020eeba3,
    0xeb01b292,
    0x442c0905,
    0xf8c64591,
    0x60348004,
    0x2400dac0,
    0xf1b9e7c6,
    0xd1e00f00,
    0x480f4b0e,
    0x30c4f8d3,
    0xf240490e,
    0x479812d1,
    0x681b4b08,
    0xc000f893,
    0xf1bce7d3,
    0xd1020f03,
    0x62344b05,
    0x9b00605e,
    0x9b01601f,
    0xb003801d,
    0x8ff0e8bd,
    0x00173274,
    0x00175aa0,
    0x00171a30,
    0x001ce588,
    0x001ce56c,
    0x00173250,
    0x68134a02,
    0x0380f423,
    0x47706013,
    0x40344014,
    0x4382f241,
    0xb4104298,
    0x4b17d825,
    0x601a4a17,
    0x4c184917,
    0x4818680b,
    0xf0234a18,
    0x600b6380,
    0xf023680b,
    0xf043030f,
    0x600b0308,
    0xf0236823,
    0xf04363c0,
    0x60236380,
    0xf85d6803,
    0xf4434b04,
    0x60036370,
    0xf4236813,
    0x60130300,
    0xf4436813,
    0x60130380,
    0xf2414770,
    0x42986344,
    0xbf944b02,
    0x4a084a07,
    0xe7d3601a,
    0x40344030,
    0x7a2a5008,
    0x40344038,
    0x4034403c,
    0x40580108,
    0x40344014,
    0x791b50c8,
    0x7a2ad0c8,
    0x786e7772,
    0x65725f6c,
    0x5f746573,
    0x5f747665,
    0x63746170,
    0x000a0d68,
    0x61647075,
    0x25206574,
    0x25202c64,
    0x000a0d64,
    0x65736572,
    0x6f642074,
    0x0a0d656e,
    0x00000000,
    0x41f0e92d,
    0x8310f3ef,
    0xd40307db,
    0x4b57b672,
    0x601a2201,
    0x49574c56,
    0x4d576823,
    0xf44f3301,
    0x60236080,
    0xfdc8f660,
    0x4000f04f,
    0xfbc6f65f,
    0x30ecf8d5,
    0x4b514798,
    0x68194a51,
    0x417ff021,
    0x68196019,
    0x0110f041,
    0x69116019,
    0x69133164,
    0x2b001acb,
    0x4e4bdafb,
    0x2410f8d5,
    0x4f4a6833,
    0x7388f443,
    0x0301f043,
    0x47906033,
    0x68134a43,
    0x0310f023,
    0x68336013,
    0x7388f423,
    0x0301f023,
    0xf6556033,
    0xf654fa9d,
    0x79bbf801,
    0xd04f2b00,
    0x681b4b3e,
    0x2b03781b,
    0x783bd05a,
    0xd0472b00,
    0x797e4b3b,
    0xf997681a,
    0xf9973007,
    0xf8dfe004,
    0x4838c0f8,
    0x1000f8dc,
    0x81e0f8d5,
    0xf0024d30,
    0x4416020f,
    0x4433b276,
    0xbfa84573,
    0xfa5f4673,
    0xf021fe83,
    0xea4101ff,
    0xf8cc010e,
    0x68021000,
    0x02fff022,
    0x020eea42,
    0xf8dc6002,
    0x1eda1000,
    0xfe82fa5f,
    0x217ff421,
    0x310eea41,
    0x1000f8cc,
    0xf8b76802,
    0xf422c008,
    0xea42227f,
    0x6002320e,
    0x4821692a,
    0xf64eb25d,
    0xfb012160,
    0x71fd210c,
    0x230047c0,
    0x71bb481d,
    0x46324629,
    0xfcf4f660,
    0xf44f491b,
    0xf6606080,
    0x6823fd3f,
    0x4a0bb133,
    0x68123b01,
    0xb90b6023,
    0xb662b102,
    0x81f0e8bd,
    0x681b4b14,
    0x601a2200,
    0xfccef645,
    0x2b00783b,
    0x79bbd0e6,
    0xd19b2b00,
    0xbf00e7e2,
    0x0017569c,
    0x00172600,
    0x001ce744,
    0x00171a30,
    0x40320400,
    0x40501000,
    0x40340018,
    0x001cf174,
    0x00173274,
    0x4032011c,
    0x4033b3d4,
    0x001cf180,
    0x001ce75c,
    0x001ce76c,
    0x00180000,
    0x4033b3ac,
    #if FRAMES_11MBPS_ENABLED
    0x4d40b570,
    0x78ab4c40,
    0xf8d4b913,
    0x479830e4,
    0xfceef654,
    0xff2af653,
    0xfcc0f653,
    0xfa16f65d,
    0xfb76f65b,
    0xfbe6f65c,
    0x338cf8d4,
    0x78ab4798,
    0x4a374836,
    0x4503f240,
    0x61452108,
    0x2b006151,
    0xf652d058,
    0x4d33fc4b,
    0x781b682b,
    0xd454079e,
    0xfe6af657,
    0xfb82f65d,
    0x47986e63,
    0x317cf8d4,
    0x4b2d4798,
    0x789a482d,
    0x4001f993,
    0x70192101,
    0x70d92114,
    0xf3c16801,
    0xf0410115,
    0x3a147120,
    0xb2526001,
    0x013df06f,
    0xbfb8428a,
    0x42a2460a,
    0x00c2f04f,
    0x682971d8,
    0x62184821,
    0x4622bfa8,
    0x4c20260a,
    0xf44f715e,
    0x711a757a,
    0x811d611c,
    0x788b481d,
    0x06dc6802,
    0xf022bf4c,
    0xf0424200,
    0x60024200,
    0xf0134a19,
    0x68130f01,
    0xf443bf14,
    0xf4232380,
    0x60132380,
    0x68134a15,
    0x6300f043,
    0x784b6013,
    0xf5a2b12b,
    0x68137207,
    0x0340f043,
    0xbd706013,
    0xfbe8f652,
    0x2003e7a5,
    0xfffcf645,
    0xbf00e7a6,
    0x00173254,
    0x00171a30,
    0x001804c4,
    0x00180484,
    #else
    0x4d42b570,
    0x78ab4c42,
    0xf8d4b913,
    0x479830e4,
    0xfceef654,
    0xff2af653,
    0xfcc0f653,
    0xfa16f65d,
    0xfb76f65b,
    0xfbe6f65c,
    0x338cf8d4,
    0xbf004798,
    0xbf00bf00,
    0xbf00bf00,
    0xbf00bf00,
    0xbf00bf00,
    0xbf00bf00,
    0x78abbf00,
    0xd0582b00,
    0xfc46f652,
    0x682b4d30,
    0x079e781b,
    0xf657d454,
    0xf65dfe65,
    0x6e63fb7d,
    0xf8d44798,
    0x4798317c,
    0x482b4b2a,
    0xf993789a,
    0x21014001,
    0x21147019,
    0x680170d9,
    0x0115f3c1,
    0x7120f041,
    0x60013a14,
    0xf06fb252,
    0x428a013d,
    0x460abfb8,
    0xf04f42a2,
    0x71d800c2,
    0x481f6829,
    0xbfa86218,
    0x260a4622,
    0x715e4c1d,
    0x757af44f,
    0x611c711a,
    0x481b811d,
    0x6802788b,
    0xbf4c06dc,
    0x4200f022,
    0x4200f042,
    0x4a176002,
    0x0f01f013,
    0xbf146813,
    0x2380f443,
    0x2380f423,
    0x4a136013,
    0xf0436813,
    0x60136300,
    0xb12b784b,
    0x7207f5a2,
    0xf0436813,
    0x60130340,
    0xf652bd70,
    0xe7a5fbe3,
    0xf6452003,
    0xe7a6fff7,
    0x00173254,
    0x00171a30,
    #endif
    0x0017324c,
    0x001cf174,
    0x403200f0,
    0x001ce001,
    0x001ce05d,
    0x40320480,
    0x40320310,
    0x40320440,
    0x6f727265,
    0x74203a72,
    0x65726568,
    0x20736920,
    0x6b206f6e,
    0x69742065,
    0x2072656d,
    0x67206e69,
    0x74206e65,
    0x72656d69,
    0x796e6120,
    0x65726f6d,
    0x00000a0d,
    0x6f727265,
    0x74203a72,
    0x65726568,
    0x20736920,
    0x6d206f6e,
    0x6974206d,
    0x2072656d,
    0x67206e69,
    0x74206e65,
    0x72656d69,
    0x796e6120,
    0x65726f6d,
    0x00000a0d,
    0x69742821,
    0x5f72656d,
    0x646e6570,
    0x20676e69,
    0x41482026,
    0x43415f4c,
    0x49545f30,
    0x5f52454d,
    0x29544942,
    0x00000000,
    0x69742821,
    0x5f72656d,
    0x646e6570,
    0x20676e69,
    0x41482026,
    0x43415f4c,
    0x49545f31,
    0x5f52454d,
    0x29544942,
    0x00000000,
    0x69742821,
    0x5f72656d,
    0x646e6570,
    0x20676e69,
    0x41482026,
    0x43415f4c,
    0x49545f32,
    0x5f52454d,
    0x29544942,
    0x00000000,
    0x69742821,
    0x5f72656d,
    0x646e6570,
    0x20676e69,
    0x41482026,
    0x43415f4c,
    0x49545f33,
    0x5f52454d,
    0x29544942,
    0x00000000,
    0x69742821,
    0x5f72656d,
    0x646e6570,
    0x20676e69,
    0x41482026,
    0x44495f4c,
    0x545f454c,
    0x52454d49,
    0x5449425f,
    0x00000029,
    0x69742821,
    0x5f72656d,
    0x646e6570,
    0x20676e69,
    0x41482026,
    0x45485f4c,
    0x5f42545f,
    0x454d4954,
    0x49425f52,
    0x00002954,
    0x69742821,
    0x5f72656d,
    0x646e6570,
    0x20676e69,
    0x41482026,
    0x49485f4c,
    0x49545f51,
    0x5f52454d,
    0x29544942,
    0x00000000,
    0x4b3c4a3b,
    0x6814b510,
    0x0561601c,
    0x05e2d41d,
    0x05a3d416,
    0x06e0d410,
    0x4b37d431,
    0xb122781a,
    0x0f2ff014,
    0x2201bf1c,
    0x4b34719a,
    0xf9b3681b,
    0x2b003000,
    0xbd10db0d,
    0xf6604831,
    0xe7fefb3d,
    0xfad4f652,
    0xd5e605a3,
    0x482ee7f6,
    0xfb34f660,
    0x07e1e7fe,
    0x07a2d41c,
    0x0763d442,
    0x0720d438,
    0x0621d42e,
    0x0662d424,
    0x06a3d41a,
    0xe8bdd5e3,
    0x49254010,
    0xf2404825,
    0xf660326e,
    0x2004bcc1,
    0xf81ef64d,
    0x4180f04f,
    0xf64d2004,
    0xe7c4f8a7,
    0x4010e8bd,
    0x481e491c,
    0x3265f240,
    0xbcb0f660,
    0x4010e8bd,
    0x481b4918,
    0x725bf44f,
    0xbca8f660,
    0x4010e8bd,
    0x48184914,
    0x326af240,
    0xbca0f660,
    0x4010e8bd,
    0x48154910,
    0x725af44f,
    0xbc98f660,
    0x4010e8bd,
    0x4812490c,
    0x3267f240,
    0xbc90f660,
    0x4010e8bd,
    0x480f4908,
    0x3266f240,
    0xbc88f660,
    0x40328084,
    0x40328088,
    0x001cf174,
    0x00173250,
    0x001cea90,
    0x001cea5c,
    0x001cf10c,
    0x001cebb4,
    0x001ceac4,
    0x001ceb8c,
    0x001ceb64,
    0x001ceb3c,
    0x001ceb14,
    0x001ceaec,
    0x735f6372,
    0x3d212073,
    0x4c554e20,
    0x0000004c,
    0x41f0e92d,
    0x602cf890,
    0xb0822e09,
    0xf2004604,
    0x4b4f8081,
    0x681a4f4f,
    0x1386eb06,
    0x2000f9b2,
    0x03c3eb07,
    0xf8d32a00,
    0xea4f5148,
    0xdb681886,
    0xf8956b62,
    0xf3c230a1,
    0x07595240,
    0x2007f88d,
    0xf003d45a,
    0x682b02fd,
    0xf8854943,
    0x690a20a1,
    0x33c3f503,
    0x429333a0,
    0x1ad1d862,
    0xda042900,
    0x43d2493e,
    0x428b4413,
    0x2100d95e,
    0xf66d4628,
    0xf895fb85,
    0x493830a2,
    0x22003301,
    0x0303f003,
    0x30a2f885,
    0x209bf885,
    0x20a3f885,
    0x602a690a,
    0xf884009b,
    0xb1903046,
    0x0107f10d,
    0xf66c4628,
    0xf89dfedb,
    0x2b003007,
    0xeb08d04c,
    0xeb070306,
    0xf89303c3,
    0xf0422152,
    0xf8830211,
    0x46282152,
    0xf910f66d,
    0x8de2b1a8,
    0x3046f894,
    0x1007f89d,
    0x5200f442,
    0x0303f023,
    0xf88485e2,
    0xbb613046,
    0xeb074446,
    0xf89707c6,
    0xf0433152,
    0xf8870320,
    0xb0023152,
    0x81f0e8bd,
    0xd0a22a00,
    0x0202f043,
    0x2d00e7a1,
    0x4916d194,
    0xf2404816,
    0xf660329a,
    0xe78dfc0d,
    0xf8802300,
    0xb0023046,
    0x81f0e8bd,
    0x1a9b4911,
    0xd8a0428b,
    0x20a2f895,
    0x30a3f895,
    0x0382ea43,
    0x3046f884,
    0x6b63e7c1,
    0x1320f443,
    0xe7cd6363,
    0xf4236b63,
    0x63631300,
    0xbf00e7ad,
    0x00173250,
    0x00175aa8,
    0x40501000,
    0x0001869f,
    0x001cf130,
    0x001ced04,
    0x000186a0,
    0x5f6d6d21,
    0x5f6e6362,
    0x2e766e65,
    0x635f7874,
    0x00006d66,
    0x4ff8e92d,
    0x4a414b40,
    0x6894681b,
    0x3000f9b3,
    0x2b004e3f,
    0x7a75db41,
    0xd14a2d00,
    0x72354a3d,
    0x017f6817,
    0xf8dfb16c,
    0xf8df90f8,
    0x46aa80f8,
    0x0b01f04f,
    0x3062f894,
    0xd0042b02,
    0x2c006824,
    0xe8bdd1f8,
    0xf8948ff8,
    0x2b0030da,
    0xf894d0f6,
    0x2b003064,
    0xf894d0f2,
    0xf89420d9,
    0x429a30d8,
    0xf8d9d1ec,
    0x46203170,
    0xb1204798,
    0x3000f898,
    0xf8883301,
    0xf1bb3000,
    0xd0050f00,
    0x0232f1a7,
    0x33b6f640,
    0xd818429a,
    0x4620b9d5,
    0xfe6ef65a,
    0xb9f04683,
    0x5000f888,
    0x6873e7d0,
    0xd0ba2b00,
    0x481e491d,
    0x727af44f,
    0xfb80f660,
    0x2d007a75,
    0x2301d0b4,
    0xe8bd7233,
    0x46208ff8,
    0xfe56f65a,
    0xa000f888,
    0xf04f6824,
    0x25010b00,
    0xd1b12c00,
    0xf894e7b7,
    0xf8843063,
    0x23ff3097,
    0x3098f884,
    0xf1042104,
    0xf64d006c,
    0x6873ff9b,
    0x3301b108,
    0x2b016073,
    0xf04fd002,
    0xe79f0b00,
    0xfc82f655,
    0x0b00f04f,
    0xbf00e79a,
    0x00173250,
    0x00177720,
    0x00178bf8,
    0x40328040,
    0x001cf140,
    0x001cee80,
    0x00171a30,
    0x001cf1a0,
    0x625f6d6d,
    0x655f6e63,
    0x742e766e,
    0x66635f78,
    0x0000006d,
    0x6d5f6362,
    0x000a0d63,
    0x43f8e92d,
    0x4c3f4b3e,
    0x6865681b,
    0x3000f9b3,
    0x46072b00,
    0x3d01db04,
    0xb1756065,
    0x83f8e8bd,
    0xd1f82d00,
    0x48394938,
    0x4257f240,
    0xfb1cf660,
    0x3d016865,
    0x2d006065,
    0x4e35d1f0,
    0xfc9af655,
    0xbb4b7833,
    0xbb037aa3,
    0xb16368e3,
    0x80c8f8df,
    0xf8d84e30,
    0x463051d4,
    0xf844f65f,
    0x47a8300c,
    0x2b0068e3,
    0xf897d1f5,
    0x44040063,
    0xb1197d21,
    0xf8d34b29,
    0x47983190,
    0x30dff897,
    0xd1cd2b01,
    0xe8bd4638,
    0xf65343f8,
    0xf8dfbf8b,
    0x6820808c,
    0x318cf8d8,
    0xe7d74798,
    0xf6604820,
    0x2303f90f,
    0x8063f897,
    0x210b462a,
    0xf65e204a,
    0xf108fb41,
    0xfa5f080a,
    0xf880f888,
    0x70458000,
    0xf65e7085,
    0x7833fb67,
    0xd0bd2b00,
    0x1063f897,
    0x310a4b14,
    0x1181eb01,
    0x09c1eb03,
    0x3029f899,
    0xd50c079b,
    0x8034f8df,
    0xf8892209,
    0xf8d8202a,
    0x462a3320,
    0x46384649,
    0xf8894798,
    0x2300502a,
    0xe7a17033,
    0x00173250,
    0x00178bf8,
    0x001cf158,
    0x001cefbc,
    0x001cf1a0,
    0x00178c04,
    0x00171a30,
    0x001cefd0,
    0x00175aa8,
    0x500007dd,
    0x010002f2,
    0x00000000,
    0x00000000,
    0x5f6c6168,
    0x6863616d,
    0x62615f77,
    0x69745f73,
    0x5f72656d,
    0x646e6168,
    0x5f72656c,
    0x63746170,
    0x00000068,
    0x635f6372,
    0x6b636568,
    0x7461705f,
    0x00006863,
    0x625f6d6d,
    0x745f6e63,
    0x736e6172,
    0x5f74696d,
    0x63746170,
    0x00000068,
    0x625f6d6d,
    0x745f6e63,
    0x736e6172,
    0x7474696d,
    0x705f6465,
    0x68637461,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00,
};

uint32_t VAR_WITH_VERx(patch_tbl, 3)[][2] =
{
    #if PLF_WIFI_AUDIO
    {WIFI_SETTINGS_OFST(thresh_param.beacon_linkloss_thd),         0x00003220}, // .bam_inactivity_to_duration0, .ps_tx_error_max = 50 bcn[0x32], .beacon_linkloss_thd = 32 bcn[0x20]
    {WIFI_SETTINGS_OFST(thresh_param.deepsleep_notallowed_offset), 0x07D02710}, // .deepsleep_notallowed_offset = 10 * 1000[0x2710], .ps_activity_to_us = 2000[0x07D0]
    #else
    {WIFI_SETTINGS_OFST(thresh_param.deepsleep_notallowed_offset), 0x4e202710}, // .deepsleep_notallowed_offset = 10 * 1000[0x2710], .ps_activity_to_us = 20000[0x4e20]
    #endif
    //{WIFI_SETTINGS_OFST(thresh_param.ps_activity_bcmc_to_us), 0x1f400fa0}, // .ps_activity_bcmc_to_us = 4000, .ps_activity_uc_to_us = 8000
    {WIFI_SETTINGS_OFST(thresh_param.lp_wakeup_offset), 0x080503e8}, // .lp_wakeup_offset = 1000, .tx_he_tb_prog_time = 5, .tx_agg_finish_dur = 8
    {WIFI_SETTINGS_OFST(host_if_param.host_type),       0x00000003}, // .host_type = 3,.sdio_desc_cnt = 0
    {WIFI_SETTINGS_OFST(host_if_param.pkt_cnt_128),     0x00000000}, // .pkt_cnt_128, .pkt_cnt_1600 = 0
    #if PLF_WIFI_AUDIO
    #ifdef CFG_SOFTAP
    {WIFI_SETTINGS_OFST(host_if_param.pkt_cnt_1724),    0x00000011},
    #else
    {WIFI_SETTINGS_OFST(host_if_param.pkt_cnt_1724),    0x00000011},
    #endif
    #else
    {WIFI_SETTINGS_OFST(host_if_param.pkt_cnt_1724),    0x00000011},
    #endif
    {WIFI_SETTINGS_OFST(host_if_param.buf_base_addr),   0x00000000},
    {WIFI_SETTINGS_OFST(host_if_param.desc_base_addr),  0x00000000},
    {WIFI_SETTINGS_OFST(host_if_param.desc_size),       0x00000000},
    {WIFI_SETTINGS_OFST(host_if_param.pkt_size),        0x00007800},
    #if (PLF_BT_STACK || PLF_BLE_STACK) && (PLF_WIFI_STACK)
    {WIFI_SETTINGS_OFST(host_if_param.ipc_base_addr),   0x00190000},
    {WIFI_SETTINGS_OFST(host_if_param.pkt_base_addr),   0x00190800},
    #else
    {WIFI_SETTINGS_OFST(host_if_param.ipc_base_addr),   0x00190000},
    {WIFI_SETTINGS_OFST(host_if_param.pkt_base_addr),   0x00190800},
    #endif
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[0]),   NX_TXDESC_CNT0},
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[1]),   NX_TXDESC_CNT1},
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[2]),   NX_TXDESC_CNT2},
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[3]),   NX_TXDESC_CNT3},
    {WIFI_SETTINGS_OFST(host_if_param.txdesc_cnt[4]),   NX_TXDESC_CNT4},
    {WIFI_SETTINGS_OFST(host_if_param.reord_buf_size),  NX_REORD_BUF_SIZE},
    {WIFI_SETTINGS_OFST(rx_ringbuf_conf.rx_ringbuf_start1), 0x00000000},
    {WIFI_SETTINGS_OFST(rx_ringbuf_conf.rx_ringbuf_size1), (24 * 1024)},
    {WIFI_SETTINGS_OFST(rx_ringbuf_conf.rx_ringbuf_start2), 0x00000000},
    {WIFI_SETTINGS_OFST(rx_ringbuf_conf.rx_ringbuf_size2), (1024 - 12)},
    #if FRAMES_11MBPS_ENABLED
    #if defined(CFG_WIFI_VOICE_ROLE_DONGLE)
    {WIFI_SETTINGS_OFST(thresh_param.tx_ac0_timeout),   20000}, // 20ms
    {WIFI_SETTINGS_OFST(thresh_param.tx_ac1_timeout),   20000}, // 20ms
    {WIFI_SETTINGS_OFST(thresh_param.tx_ac2_timeout),   20000}, // 20ms
    {WIFI_SETTINGS_OFST(thresh_param.tx_ac3_timeout),   20000}, // 20ms
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[0]),     0x00000a47},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[1]),     0x00000643},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[2]),     0x0005e431},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[3]),     0x0002f321},
    #else
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[0]),     0x00000000},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[1]),     0x00000000},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[2]),     0x00000000},
    {WIFI_SETTINGS_OFST(ac_param_conf.ac_param[3]),     0x00000000},
    #endif
    #endif /* FRAMES_11MBPS_ENABLED */
#if CONFIG_SLEEP_LEVEL == 0
    {WIFI_SETTINGS_OFST(lp_level), 0x8d080000}, // .lp_level = 0, .bt_use_wifi_rf = 0, .debug_mask=0x8d08
#elif CONFIG_SLEEP_LEVEL == 1
    {WIFI_SETTINGS_OFST(lp_level), 0xffff0001}, // .lp_level = 1, .bt_use_wifi_rf = 0, .debug_mask=0xffff
#elif CONFIG_SLEEP_LEVEL >= 2
    {WIFI_SETTINGS_OFST(lp_level), 0xffff0002}, // .lp_level = 2, .bt_use_wifi_rf = 0, .debug_mask=0xffff
#endif
    #if PLF_BAND5G
    // Attention, GPIOs used by 5g fem maybe conflict with audio I2SM.
    {WIFI_SETTINGS_OFST(txgain_config.fix_txgain_en),   0xd0e0d003}, // .fix_txgain_en = 3, .fix_txgain_val = 0xd0, .fix_txgain_val_5g = 0xe0, .fix_1024qam_txgain = 0xd0
    {WIFI_SETTINGS_OFST(use_5g),                        0x00010001}, // .use_5g = 1, .clkgate_use_hwbcn = 0, .poweroff_use_hwbcn = 1
    #else
    {WIFI_SETTINGS_OFST(txgain_config.fix_txgain_en),   0xd0e0f301}, // .fix_txgain_en = 1, .fix_txgain_val = 0xf3, .fix_txgain_val_5g = 0xe0, .fix_1024qam_txgain = 0xd0
    #endif
};

uint32_t VAR_WITH_VERx(patch_tbl_func, 3)[][2] =
{
    { JUMP_TABLE_OFSTx(154, 3), 0x001cf001 }, //rc_check_patch
    { KE_EVT_HDLR_OFSTx( 0, 3), 0x001cf169 }, //rwnxl_reset_evt_patch
    { JUMP_TABLE_OFSTx(295, 3), 0x001cf315 }, //hw_reg_config_before_rf_calib_patch
    { JUMP_TABLE_OFSTx(146, 3), 0x001cf485 }, //ps_check_tx_frame_patch
    { JUMP_TABLE_OFSTx(302, 3), 0x001cf53d }, //rwnx_sleep_deepsleep_config_patch
    { JUMP_TABLE_OFSTx(196, 3), 0x001cf70d }, //sm_delete_resources_patch
	{ JUMP_TABLE_OFSTx(256, 3), 0x001cf819 }, //txl_hwdesc_config_post_patch
	{ JUMP_TABLE_OFSTx(281, 3), 0x001cfa91 }, //vif_mgmt_unregister_patch
    { JUMP_TABLE_OFSTx(283, 3), 0x001cfc85 }, //wifi_lp_recover_from_pd_patch
#if FRAMES_11MBPS_ENABLED
    { JUMP_TABLE_OFSTx(106, 3), 0x001cfd71 }, //mm_init_patch
#endif
};

uint32_t VAR_WITH_VERx(patch_func, 3)[] =
{
#if FRAMES_11MBPS_ENABLED
    0x41f0e92d,
    0x602cf890,
    0xb0822e09,
    0xd87f4604,
    0x4f4f4b4e,
    0xeb06681a,
    0xf9b21386,
    0xeb072000,
    0x2a0003c3,
    0x5148f8d3,
    0x1886ea4f,
    0x6b62db68,
    0x30a1f895,
    0x5240f3c2,
    0xf88d0759,
    0xd45a2007,
    0x02fdf003,
    0x4943682b,
    0x20a1f885,
    0xf503690a,
    0x33a033c3,
    0xd8614293,
    0x29001ad1,
    0x493eda04,
    0x441343d2,
    0xd95d428b,
    0x46282100,
    0xf8e8f66e,
    0x30a2f895,
    0x33014937,
    0xf0032200,
    0xf8850303,
    0xf88530a2,
    0xf885209b,
    0x690a20a3,
    0x009b602a,
    0x3046f884,
    0xf10db190,
    0x46280107,
    0xfc3ef66d,
    0x3007f89d,
    0xd04b2b00,
    0x0306eb08,
    0x03c3eb07,
    0x2152f893,
    0x0211f042,
    0x2152f883,
    0xf66d4628,
    0xb1a8fe73,
    0xf8948de2,
    0xf89d3046,
    0xf4421007,
    0xf0235200,
    0x85e20303,
    0x3046f884,
    0x4446bb59,
    0x07c6eb07,
    0x3152f897,
    0x0320f043,
    0x3152f887,
    0xe8bdb002,
    0x2a0081f0,
    0xf043d0a2,
    0xe7a10202,
    0xd1942d00,
    0x48164915,
    0xf660224d,
    0xe78efff7,
    0xf8802300,
    0xb0023046,
    0x81f0e8bd,
    0x1a9b4911,
    0xd8a1428b,
    0x20a2f895,
    0x30a3f895,
    0x0382ea43,
    0x3046f884,
    0x6b63e7c2,
    0x1320f443,
    0xe7ce6363,
    0xf4236b63,
    0x63631300,
    0xbf00e7ae,
    0x001732b0,
    0x00176020,
    0x40501000,
    0x0001869f,
    0x001cff44,
    0x001cfe60,
    0x000186a0,
    0x41f0e92d,
    0x8310f3ef,
    0xd40307db,
    0x4b57b672,
    0x601a2201,
    0x49574c56,
    0x4d576823,
    0xf44f3301,
    0x60236080,
    0xfe08f660,
    0x4000f04f,
    0xfc06f65f,
    0x30ecf8d5,
    0x4b514798,
    0x68194a51,
    0x417ff021,
    0x68196019,
    0x0110f041,
    0x69116019,
    0x69133164,
    0x2b001acb,
    0x4e4bdafb,
    0x2410f8d5,
    0x4f4a6833,
    0x7388f443,
    0x0301f043,
    0x47906033,
    0x68134a43,
    0x0310f023,
    0x68336013,
    0x7388f423,
    0x0301f023,
    0xf6556033,
    0xf654fadb,
    0x79bbf847,
    0xd04f2b00,
    0x681b4b3e,
    0x2b03781b,
    0x783bd05a,
    0xd0472b00,
    0x797e4b3b,
    0xf997681a,
    0xf9973007,
    0xf8dfe004,
    0x4838c0f8,
    0x1000f8dc,
    0x81e0f8d5,
    0xf0024d30,
    0x4416020f,
    0x4433b276,
    0xbfa84573,
    0xfa5f4673,
    0xf021fe83,
    0xea4101ff,
    0xf8cc010e,
    0x68021000,
    0x02fff022,
    0x020eea42,
    0xf8dc6002,
    0x1eda1000,
    0xfe82fa5f,
    0x217ff421,
    0x310eea41,
    0x1000f8cc,
    0xf8b76802,
    0xf422c008,
    0xea42227f,
    0x6002320e,
    0x4821692a,
    0xf64eb25d,
    0xfb012160,
    0x71fd210c,
    0x230047c0,
    0x71bb481d,
    0x46324629,
    0xfd34f660,
    0xf44f491b,
    0xf6606080,
    0x6823fd7f,
    0x4a0bb133,
    0x68123b01,
    0xb90b6023,
    0xb662b102,
    0x81f0e8bd,
    0x681b4b14,
    0x601a2200,
    0xf826f645,
    0x2b00783b,
    0x79bbd0e6,
    0xd19b2b00,
    0xbf00e7e2,
    0x00175bfc,
    0x00172618,
    0x001cfe70,
    0x00171a3c,
    0x40320400,
    0x40501000,
    0x40340018,
    0x0017325c,
    0x001732d4,
    0x4032011c,
    0x4033b3d4,
    0x00173268,
    0x001cfe88,
    0x001cfe98,
    0x00180000,
    0x4033b3ac,
    0x4d52b470,
    0x682b4852,
    0x4a534c52,
    0x4e544953,
    0x63c0f423,
    0x7300f443,
    0x6803602b,
    0x03bcf423,
    0x5370f423,
    0x2360f443,
    0x6380f443,
    0x68236003,
    0x0360f023,
    0x68136023,
    0x33fef423,
    0x3398f443,
    0x680b6013,
    0x63c0f023,
    0x7300f043,
    0x69ab600b,
    0x50fff5a0,
    0xf0433814,
    0x61ab6380,
    0xf4436803,
    0x60036300,
    0xf4236a23,
    0xf043737f,
    0x62230304,
    0xf5a26803,
    0xf5a2120f,
    0xf42352fe,
    0x3a1c5380,
    0x6300f443,
    0x68136003,
    0x41daf501,
    0x03ccf023,
    0xf043316c,
    0x601303c4,
    0xf003680b,
    0xf5a5437f,
    0xf44355f7,
    0x3d141378,
    0x7378f443,
    0x682b600b,
    0xf5a40c1b,
    0x041b5400,
    0xf0433c14,
    0x602b0384,
    0x4d286823,
    0x6340f423,
    0x6300f443,
    0xf8d06023,
    0xf5023104,
    0xf42352f8,
    0x321823e0,
    0x3380f443,
    0x3104f8c0,
    0xf0236813,
    0xf0235376,
    0xf5010307,
    0xf04351f7,
    0x31045304,
    0x0307f043,
    0x680b6013,
    0x5400f504,
    0x52eff102,
    0x5001f500,
    0xf502341c,
    0x401d223d,
    0x0244f602,
    0x600d4b13,
    0x60323008,
    0x68036023,
    0xf4234a11,
    0xf423237f,
    0xf4436300,
    0x60033332,
    0xf44368cb,
    0x60cb6300,
    0xf0236813,
    0xf4430309,
    0xbc705380,
    0x47706013,
    0x40344020,
    0x40344024,
    0x40344028,
    0x40580104,
    0x4033b3b8,
    0x4034402c,
    0xff000003,
    0x1a2e5108,
    0x40580108,
    0x4b22b538,
    0x2a00781a,
    0x28ffd03e,
    0x29ffd03c,
    0x491fd03a,
    0xeb004c1f,
    0xeb011080,
    0xf44f00c0,
    0x7f8261a4,
    0x4202fb01,
    0x1062f892,
    0xd12b2900,
    0x1064f892,
    0x4818b341,
    0x68004918,
    0x8ec56909,
    0x615a4c17,
    0x77582003,
    0x21e0f8d4,
    0x000cf103,
    0x47904429,
    0x681b4b13,
    0xd515075b,
    0xf8934b12,
    0xb17330b6,
    0x681b4b11,
    0x2b02781b,
    0x4910d109,
    0x680b4a10,
    0x7300f423,
    0x6813600b,
    0x0301f023,
    0xf8d46013,
    0x47983254,
    0xbd382000,
    0x001792b4,
    0x00176020,
    0x00177cb0,
    0x001732a4,
    0x40501000,
    0x00171a3c,
    0x4032004c,
    0x00171934,
    0x001732d0,
    0x4033b390,
    0x4032008c,
    0xf0002800,
    0xe92d80a4,
    0xf8904ff0,
    0xb0833064,
    0xb9134604,
    0xe8bdb003,
    0x4b5a8ff0,
    0x4e5b4a5a,
    0xc470f8d2,
    0x4a5b4f5a,
    0xb180f8df,
    0xf8df485a,
    0xf8dfa198,
    0xf04f9198,
    0xf8c30802,
    0x68b68180,
    0xc044f8c6,
    0xf8c32601,
    0x703e8000,
    0x6010f8db,
    0x607e6813,
    0x0302f023,
    0x68066013,
    0x3000f8da,
    0x20b2f8b9,
    0x92008f9b,
    0x46320176,
    0x4640460d,
    0xf660494a,
    0xf8dafbf7,
    0xf8b93000,
    0x8f9b20b2,
    0x42b34413,
    0x687ad2c6,
    0x46404945,
    0xfbeaf660,
    0x2010f8db,
    0x1a9b68fb,
    0xda662b00,
    0x2068f8b4,
    0x68694b40,
    0x0d23f893,
    0xd9512a05,
    0xfb013a01,
    0xf8936602,
    0x493c3d23,
    0x20024632,
    0xfbd2f660,
    0x2000f8da,
    0x30b2f8b9,
    0x4c328f92,
    0x441a4937,
    0x68236908,
    0x1ab64936,
    0x0203f026,
    0x0303f003,
    0x60234313,
    0x4c33680b,
    0xf04360be,
    0x600b0301,
    0x68226823,
    0x0309f3c3,
    0x727ff422,
    0x0301f043,
    0x0203f022,
    0x60234313,
    0x4406680b,
    0x60fe075b,
    0x4b29d503,
    0x7200f44f,
    0x4c28601a,
    0x68234828,
    0x4a22491c,
    0x0308f043,
    0x68036023,
    0x0302f043,
    0x680b6003,
    0x0301f043,
    0x6911600b,
    0x7196f501,
    0x1a5b6913,
    0xdbfb2b00,
    0xe8bdb003,
    0x47708ff0,
    0x2d24f893,
    0xd9ac2a01,
    0x2d23f893,
    0xf893b172,
    0x3a012d23,
    0x6602fb01,
    0x4b0ee7a3,
    0xf8934915,
    0x46403d23,
    0xf6604632,
    0xe7a1fb75,
    0x2d24f893,
    0xbf00e794,
    0xe000e100,
    0x00171a3c,
    0xe000ed00,
    0x001732b4,
    0x40320084,
    0x40328040,
    0x001cfea8,
    0x001cfeb8,
    0x001e4000,
    0x001cfed4,
    0x40501000,
    0x40044084,
    0x40506000,
    0x40044100,
    0x40580010,
    0x40580018,
    0x001cfec0,
    0x001732a4,
    0x00171934,
    0x41f0e92d,
    0x46042302,
    0x21052206,
    0x4019f241,
    0xfd2af65e,
    0x23022206,
    0x21054606,
    0x4017f241,
    0xfd22f65e,
    0x80e0f8df,
    0x46054933,
    0x7080f44f,
    0xfb30f660,
    0xfe40f664,
    0xf64c4620,
    0x2700feed,
    0x006cf894,
    0x3024f8d8,
    0x70374798,
    0x3063f894,
    0x482a7073,
    0x010cf1a6,
    0xf99cf65f,
    0x3064f894,
    0xf894bb7b,
    0x2bff306c,
    0x2301d00d,
    0x22062100,
    0xf65e200c,
    0x4601fcf9,
    0x306cf894,
    0x390cf801,
    0xf65f481e,
    0x6c23f987,
    0x2301b16b,
    0x22062100,
    0xf65e2039,
    0x4601fce9,
    0x3063f894,
    0x390cf801,
    0xf65f4816,
    0x2300f977,
    0xf894702b,
    0x706b3063,
    0x010cf1a5,
    0xf65f4811,
    0xe8bdf96d,
    0xf66441f0,
    0x2206bf4b,
    0x46392304,
    0xf65e201e,
    0x7087fccd,
    0x3063f894,
    0xf1a070c3,
    0x4808010c,
    0xf95af65f,
    0x31d8f8d8,
    0x47984806,
    0x775f4b06,
    0xf4236863,
    0x60637380,
    0xbf00e7b5,
    0x001cfee4,
    0x0017af08,
    0x001792c0,
    0x001792b4,
    0x00171a3c,
    0x43f0e92d,
    0x6cc56b43,
    0x1800f413,
    0x4604b083,
    0x0728f105,
    0xf403d008,
    0xf5b31360,
    0xf0001f20,
    0xb003808f,
    0x83f0e8bd,
    0x6d068dc3,
    0xd538071a,
    0x9240f8df,
    0x2000f8d9,
    0x2000f9b2,
    0xf2c02a00,
    0x6a7180c3,
    0x6a32b909,
    0x06186891,
    0xf894d509,
    0x2b003043,
    0x80d1f040,
    0x3045f894,
    0xf0402b00,
    0x6cf380d3,
    0x03f0f423,
    0x790b64f3,
    0xf01363b7,
    0xbf080f01,
    0x7800f44f,
    0xf8c62300,
    0x65338048,
    0x6e2a6aeb,
    0xf0436372,
    0x62eb0302,
    0xf6514620,
    0x6ce2fd93,
    0xf0436a53,
    0x62530310,
    0xe8bdb003,
    0x4b6e83f0,
    0x3428f8d3,
    0x6deb4798,
    0xf89464b3,
    0x496b202b,
    0x60a4f44f,
    0x1202fb00,
    0x2062f892,
    0xf894bb32,
    0x4967202c,
    0x1282eb02,
    0x02c2eb01,
    0x2124f8d2,
    0xd51b0692,
    0xf4128de2,
    0x6be25f00,
    0xbf146bd2,
    0x1200f3c2,
    0x02c0f3c2,
    0xf8d6b982,
    0xf8bcc024,
    0x04102000,
    0xd509b291,
    0x200ae9d6,
    0x010ef3c1,
    0x3a043804,
    0x1000f8ac,
    0x200ae9c6,
    0x8160f8df,
    0xf8d863b7,
    0x6d272000,
    0x2000f9b2,
    0xdb472a00,
    0xb90a6a7a,
    0x68926a3a,
    0x63c0f423,
    0x791264b3,
    0xbf5c07d2,
    0x7300f443,
    0xe79f64b3,
    0x6c866b83,
    0x22c2f3c3,
    0x63372a05,
    0xf403d10d,
    0x6cea63c0,
    0x6f80f5b3,
    0xf44fbf14,
    0xf44f3380,
    0xf4223300,
    0x431a3240,
    0xf10464ea,
    0xf64f0038,
    0xf8d4ff49,
    0x6ba2c04c,
    0xf8dc88b0,
    0x6de93024,
    0x6aea63ea,
    0x0408f040,
    0xf44180b4,
    0x6e2c60c0,
    0xf04262f4,
    0x64300202,
    0x0310f043,
    0x463962ea,
    0x7082f506,
    0xf8cc2234,
    0xb0033024,
    0x43f0e8bd,
    0xb8eef66f,
    0x2a006ce2,
    0x6a7ad03c,
    0xd1b52a00,
    0xb1926a3a,
    0xe7b06cb3,
    0x6a71b32d,
    0xf47f2900,
    0x6a32af3c,
    0x8de3b10a,
    0x4923e736,
    0xf2404823,
    0xf66012b9,
    0x6a32fb7f,
    0x491fe7f5,
    0xf240481f,
    0xf66012b9,
    0x6a3afb77,
    0x2220e7e4,
    0x91014620,
    0xffb8f669,
    0xe72c9901,
    0x91018922,
    0xf66b4620,
    0x9901f8d1,
    0x4914e725,
    0xf44f4815,
    0xf66072d9,
    0x6a71fb61,
    0xf8d9b9a9,
    0xf9b33000,
    0x2b003000,
    0xe7d8dbcf,
    0x72d9f44f,
    0x480d490b,
    0xfb52f660,
    0xb9426a7a,
    0x3000f8d8,
    0x3000f9b3,
    0xdbb72b00,
    0x8de3e7d1,
    0x6cb3e6f9,
    0xbf00e768,
    0x00171a3c,
    0x00177cb0,
    0x00176020,
    0x001cff2c,
    0x001cff18,
    0x001cfef8,
    0x001732b0,
    0x43f8e92d,
    0x4d6f4604,
    0xf44f486f,
    0xfb0666a4,
    0x19aff604,
    0xf65f4639,
    0x4b6cf84b,
    0x42ba6a1a,
    0x2200bf04,
    0xf44f621a,
    0xfb0363a4,
    0xf8935304,
    0x2b023062,
    0x809ef000,
    0xd0722b04,
    0x91a0f8df,
    0x81a8f8df,
    0xd0632b00,
    0x3012f899,
    0x2011f899,
    0x2b014413,
    0x495ed114,
    0x0008f8d9,
    0xc190f8df,
    0x2300e9d1,
    0x0310f023,
    0x431a604b,
    0x4b5a4959,
    0x2000f8cc,
    0xc038f8d0,
    0xf8c18f82,
    0x601ac000,
    0x0018f106,
    0x31d8f8d8,
    0x47984428,
    0x0028f106,
    0x31d8f8d8,
    0x47984428,
    0x63a4f44f,
    0x5304fb03,
    0x24c0f893,
    0xf44fbb4a,
    0xfb0363a4,
    0xf8935304,
    0xf65c0063,
    0x4b49fe19,
    0x42ba691a,
    0x2200bf04,
    0x2100611a,
    0x62a4f44f,
    0xf6404638,
    0xf44ffb27,
    0xfb0060a4,
    0xf8d85404,
    0x62e33450,
    0x237f2205,
    0x63274639,
    0x2062f884,
    0x3065f884,
    0x3066f884,
    0xe8bd483b,
    0xf65e43f8,
    0xf893bf8b,
    0x210104c1,
    0xf856f65c,
    0x3013f899,
    0xf8893b01,
    0xe7ca3013,
    0x2011f899,
    0x3012f899,
    0xb2d23a01,
    0x2011f889,
    0xf641e796,
    0x2800fab7,
    0xf8dfd137,
    0xf8df90b4,
    0xf89980bc,
    0xf44f0010,
    0xfb0363a4,
    0x685a5300,
    0xf0226c19,
    0x605a0280,
    0xf8d8b111,
    0x47983054,
    0x3012f899,
    0x481eb9e3,
    0x68424922,
    0xc090f8df,
    0x430a6001,
    0x2000f8cc,
    0xf89921ff,
    0xf8892011,
    0xe76d1010,
    0x9068f8df,
    0x3012f899,
    0xb2db3b01,
    0x3012f889,
    0xf899b1cb,
    0xf8df2011,
    0xe75f8060,
    0xf982f655,
    0x3012f899,
    0x2000e7e6,
    0xfa84f641,
    0x681a4b11,
    0xd5c005d2,
    0x7280f44f,
    0x2080f8c3,
    0x8f4ff3bf,
    0x8f6ff3bf,
    0xf655e7b7,
    0xf8dff993,
    0xe741802c,
    0x00177cb0,
    0x00177ca0,
    0x001792b4,
    0x00179130,
    0x40320020,
    0x40320024,
    0x00175f48,
    0x00177c98,
    0x3503858c,
    0xe000e100,
    0x00171a3c,
    0x40320060,
    0x41f0e92d,
    0xf8df4d32,
    0xf8d580e0,
    0xf89834d0,
    0x4e307d22,
    0xf8d84798,
    0xf64041bc,
    0xf8d5fce3,
    0x4798349c,
    0xf8d5492c,
    0x680b2488,
    0x7300f423,
    0x7920600b,
    0x79234790,
    0x302af886,
    0xf8867962,
    0x7b62202b,
    0x202cf886,
    0x892088e1,
    0x85328962,
    0x84b1b2ff,
    0xb9d384f0,
    0x34a0f8d5,
    0x8cf04798,
    0x34a4f8d5,
    0x4e1d4798,
    0x000cf994,
    0x333cf8d5,
    0xf8d54798,
    0xf50634d4,
    0x463061a4,
    0xf0174798,
    0xd00c0f0d,
    0x3254f8d5,
    0x41f0e8bd,
    0xf8d54718,
    0x479834a8,
    0xf8d58cf0,
    0x479834ac,
    0x07bbe7e3,
    0x4a0fd514,
    0x3180f8d8,
    0x480e6911,
    0x21e0f8d5,
    0x24056146,
    0xf5017744,
    0xf043511c,
    0xf8c80302,
    0x31103180,
    0x41f0e8bd,
    0x4710300c,
    0x81f0e8bd,
    0x00171a3c,
    0x00173198,
    0x4033b390,
    0x001e417c,
    0x40501000,
    0x001792b4,
    0x001e4000,
    0x4d31b538,
    0x78ab4c31,
    0xf8d4b913,
    0x479830e4,
    0xf806f654,
    0xfa42f653,
    0xffdaf652,
    0xfd1cf65c,
    0xfe7cf65a,
    0xfeecf65b,
    0x338cf8d4,
    0x78ab4798,
    0x4a284827,
    0x4503f240,
    0x61452108,
    0x2b006151,
    0xf651d03a,
    0x4d24fef5,
    0x781b682b,
    0xd436079b,
    0xf95ef657,
    0xfe88f65c,
    0x47986e63,
    0x317cf8d4,
    0xf6454798,
    0x4a1df8e7,
    0x6813481d,
    0x0315f3c3,
    0x7320f043,
    0x682a6013,
    0x78936801,
    0xbf4c06dc,
    0x4100f021,
    0x4100f041,
    0x49166001,
    0x0f01f013,
    0xbf14680b,
    0x2380f443,
    0x2380f423,
    0x4912600b,
    0xf043680b,
    0x600b6300,
    0xb1237853,
    0x68134a0f,
    0x0340f043,
    0xbd386013,
    0xfeb0f651,
    0x2003e7c3,
    0xfe44f644,
    0xbf00e7c4,
    0x001732b4,
    0x00171a3c,
    0x001804c4,
    0x00180484,
    0x001732ac,
    0x403200f0,
    0x40320480,
    0x40320310,
    0x40320440,
    0x40320224,
    0x735f6372,
    0x3d212073,
    0x4c554e20,
    0x0000004c,
    0x786e7772,
    0x65725f6c,
    0x5f746573,
    0x5f747665,
    0x63746170,
    0x000a0d68,
    0x61647075,
    0x25206574,
    0x25202c64,
    0x000a0d64,
    0x65736572,
    0x6f642074,
    0x0a0d656e,
    0x00000000,
    0x20676663,
    0x25206425,
    0x64252064,
    0x00000a0d,
    0x78253d74,
    0x00000a0d,
    0x20746f6e,
    0x74736170,
    0x6425203a,
    0x0d64252c,
    0x0000000a,
    0x73736170,
    0x6425203a,
    0x0d64252c,
    0x0000000a,
    0x656c6564,
    0x72206574,
    0x72756f65,
    0x0d736563,
    0x0000000a,
    0x5f6c7874,
    0x66667562,
    0x675f7265,
    0x74287465,
    0x73656478,
    0x21202963,
    0x554e203d,
    0x00004c4c,
    0x2d646874,
    0x7269663e,
    0x705f7473,
    0x705f6462,
    0x00007274,
    0x5f6c7874,
    0x66667562,
    0x6d5f7265,
    0x64686361,
    0x65675f72,
    0x00000074,
    0x635f6372,
    0x6b636568,
    0x7461705f,
    0x006863,
#else
    0x41f0e92d,
    0x602cf890,
    0xb0822e09,
    0xd87f4604,
    0x4f4f4b4e,
    0xeb06681a,
    0xf9b21386,
    0xeb072000,
    0x2a0003c3,
    0x5148f8d3,
    0x1886ea4f,
    0x6b62db68,
    0x30a1f895,
    0x5240f3c2,
    0xf88d0759,
    0xd45a2007,
    0x02fdf003,
    0x4943682b,
    0x20a1f885,
    0xf503690a,
    0x33a033c3,
    0xd8614293,
    0x29001ad1,
    0x493eda04,
    0x441343d2,
    0xd95d428b,
    0x46282100,
    0xf8e8f66e,
    0x30a2f895,
    0x33014937,
    0xf0032200,
    0xf8850303,
    0xf88530a2,
    0xf885209b,
    0x690a20a3,
    0x009b602a,
    0x3046f884,
    0xf10db190,
    0x46280107,
    0xfc3ef66d,
    0x3007f89d,
    0xd04b2b00,
    0x0306eb08,
    0x03c3eb07,
    0x2152f893,
    0x0211f042,
    0x2152f883,
    0xf66d4628,
    0xb1a8fe73,
    0xf8948de2,
    0xf89d3046,
    0xf4421007,
    0xf0235200,
    0x85e20303,
    0x3046f884,
    0x4446bb59,
    0x07c6eb07,
    0x3152f897,
    0x0320f043,
    0x3152f887,
    0xe8bdb002,
    0x2a0081f0,
    0xf043d0a2,
    0xe7a10202,
    0xd1942d00,
    0x48164915,
    0xf660224d,
    0xe78efff7,
    0xf8802300,
    0xb0023046,
    0x81f0e8bd,
    0x1a9b4911,
    0xd8a1428b,
    0x20a2f895,
    0x30a3f895,
    0x0382ea43,
    0x3046f884,
    0x6b63e7c2,
    0x1320f443,
    0xe7ce6363,
    0xf4236b63,
    0x63631300,
    0xbf00e7ae,
    0x001732b0,
    0x00176020,
    0x40501000,
    0x0001869f,
    0x001cfe54,
    0x001cfd70,
    0x000186a0,
    0x41f0e92d,
    0x8310f3ef,
    0xd40307db,
    0x4b57b672,
    0x601a2201,
    0x49574c56,
    0x4d576823,
    0xf44f3301,
    0x60236080,
    0xfe08f660,
    0x4000f04f,
    0xfc06f65f,
    0x30ecf8d5,
    0x4b514798,
    0x68194a51,
    0x417ff021,
    0x68196019,
    0x0110f041,
    0x69116019,
    0x69133164,
    0x2b001acb,
    0x4e4bdafb,
    0x2410f8d5,
    0x4f4a6833,
    0x7388f443,
    0x0301f043,
    0x47906033,
    0x68134a43,
    0x0310f023,
    0x68336013,
    0x7388f423,
    0x0301f023,
    0xf6556033,
    0xf654fadb,
    0x79bbf847,
    0xd04f2b00,
    0x681b4b3e,
    0x2b03781b,
    0x783bd05a,
    0xd0472b00,
    0x797e4b3b,
    0xf997681a,
    0xf9973007,
    0xf8dfe004,
    0x4838c0f8,
    0x1000f8dc,
    0x81e0f8d5,
    0xf0024d30,
    0x4416020f,
    0x4433b276,
    0xbfa84573,
    0xfa5f4673,
    0xf021fe83,
    0xea4101ff,
    0xf8cc010e,
    0x68021000,
    0x02fff022,
    0x020eea42,
    0xf8dc6002,
    0x1eda1000,
    0xfe82fa5f,
    0x217ff421,
    0x310eea41,
    0x1000f8cc,
    0xf8b76802,
    0xf422c008,
    0xea42227f,
    0x6002320e,
    0x4821692a,
    0xf64eb25d,
    0xfb012160,
    0x71fd210c,
    0x230047c0,
    0x71bb481d,
    0x46324629,
    0xfd34f660,
    0xf44f491b,
    0xf6606080,
    0x6823fd7f,
    0x4a0bb133,
    0x68123b01,
    0xb90b6023,
    0xb662b102,
    0x81f0e8bd,
    0x681b4b14,
    0x601a2200,
    0xf826f645,
    0x2b00783b,
    0x79bbd0e6,
    0xd19b2b00,
    0xbf00e7e2,
    0x00175bfc,
    0x00172618,
    0x001cfd80,
    0x00171a3c,
    0x40320400,
    0x40501000,
    0x40340018,
    0x0017325c,
    0x001732d4,
    0x4032011c,
    0x4033b3d4,
    0x00173268,
    0x001cfd98,
    0x001cfda8,
    0x00180000,
    0x4033b3ac,
    0x4d52b470,
    0x682b4852,
    0x4a534c52,
    0x4e544953,
    0x63c0f423,
    0x7300f443,
    0x6803602b,
    0x03bcf423,
    0x5370f423,
    0x2360f443,
    0x6380f443,
    0x68236003,
    0x0360f023,
    0x68136023,
    0x33fef423,
    0x3398f443,
    0x680b6013,
    0x63c0f023,
    0x7300f043,
    0x69ab600b,
    0x50fff5a0,
    0xf0433814,
    0x61ab6380,
    0xf4436803,
    0x60036300,
    0xf4236a23,
    0xf043737f,
    0x62230304,
    0xf5a26803,
    0xf5a2120f,
    0xf42352fe,
    0x3a1c5380,
    0x6300f443,
    0x68136003,
    0x41daf501,
    0x03ccf023,
    0xf043316c,
    0x601303c4,
    0xf003680b,
    0xf5a5437f,
    0xf44355f7,
    0x3d141378,
    0x7378f443,
    0x682b600b,
    0xf5a40c1b,
    0x041b5400,
    0xf0433c14,
    0x602b0384,
    0x4d286823,
    0x6340f423,
    0x6300f443,
    0xf8d06023,
    0xf5023104,
    0xf42352f8,
    0x321823e0,
    0x3380f443,
    0x3104f8c0,
    0xf0236813,
    0xf0235376,
    0xf5010307,
    0xf04351f7,
    0x31045304,
    0x0307f043,
    0x680b6013,
    0x5400f504,
    0x52eff102,
    0x5001f500,
    0xf502341c,
    0x401d223d,
    0x0244f602,
    0x600d4b13,
    0x60323008,
    0x68036023,
    0xf4234a11,
    0xf423237f,
    0xf4436300,
    0x60033332,
    0xf44368cb,
    0x60cb6300,
    0xf0236813,
    0xf4430309,
    0xbc705380,
    0x47706013,
    0x40344020,
    0x40344024,
    0x40344028,
    0x40580104,
    0x4033b3b8,
    0x4034402c,
    0xff000003,
    0x1a2e5108,
    0x40580108,
    0x4b22b538,
    0x2a00781a,
    0x28ffd03e,
    0x29ffd03c,
    0x491fd03a,
    0xeb004c1f,
    0xeb011080,
    0xf44f00c0,
    0x7f8261a4,
    0x4202fb01,
    0x1062f892,
    0xd12b2900,
    0x1064f892,
    0x4818b341,
    0x68004918,
    0x8ec56909,
    0x615a4c17,
    0x77582003,
    0x21e0f8d4,
    0x000cf103,
    0x47904429,
    0x681b4b13,
    0xd515075b,
    0xf8934b12,
    0xb17330b6,
    0x681b4b11,
    0x2b02781b,
    0x4910d109,
    0x680b4a10,
    0x7300f423,
    0x6813600b,
    0x0301f023,
    0xf8d46013,
    0x47983254,
    0xbd382000,
    0x001792b4,
    0x00176020,
    0x00177cb0,
    0x001732a4,
    0x40501000,
    0x00171a3c,
    0x4032004c,
    0x00171934,
    0x001732d0,
    0x4033b390,
    0x4032008c,
    0xf0002800,
    0xe92d80a4,
    0xf8904ff0,
    0xb0833064,
    0xb9134604,
    0xe8bdb003,
    0x4b5a8ff0,
    0x4e5b4a5a,
    0xc470f8d2,
    0x4a5b4f5a,
    0xb180f8df,
    0xf8df485a,
    0xf8dfa198,
    0xf04f9198,
    0xf8c30802,
    0x68b68180,
    0xc044f8c6,
    0xf8c32601,
    0x703e8000,
    0x6010f8db,
    0x607e6813,
    0x0302f023,
    0x68066013,
    0x3000f8da,
    0x20b2f8b9,
    0x92008f9b,
    0x46320176,
    0x4640460d,
    0xf660494a,
    0xf8dafbf7,
    0xf8b93000,
    0x8f9b20b2,
    0x42b34413,
    0x687ad2c6,
    0x46404945,
    0xfbeaf660,
    0x2010f8db,
    0x1a9b68fb,
    0xda662b00,
    0x2068f8b4,
    0x68694b40,
    0x0d23f893,
    0xd9512a05,
    0xfb013a01,
    0xf8936602,
    0x493c3d23,
    0x20024632,
    0xfbd2f660,
    0x2000f8da,
    0x30b2f8b9,
    0x4c328f92,
    0x441a4937,
    0x68236908,
    0x1ab64936,
    0x0203f026,
    0x0303f003,
    0x60234313,
    0x4c33680b,
    0xf04360be,
    0x600b0301,
    0x68226823,
    0x0309f3c3,
    0x727ff422,
    0x0301f043,
    0x0203f022,
    0x60234313,
    0x4406680b,
    0x60fe075b,
    0x4b29d503,
    0x7200f44f,
    0x4c28601a,
    0x68234828,
    0x4a22491c,
    0x0308f043,
    0x68036023,
    0x0302f043,
    0x680b6003,
    0x0301f043,
    0x6911600b,
    0x7196f501,
    0x1a5b6913,
    0xdbfb2b00,
    0xe8bdb003,
    0x47708ff0,
    0x2d24f893,
    0xd9ac2a01,
    0x2d23f893,
    0xf893b172,
    0x3a012d23,
    0x6602fb01,
    0x4b0ee7a3,
    0xf8934915,
    0x46403d23,
    0xf6604632,
    0xe7a1fb75,
    0x2d24f893,
    0xbf00e794,
    0xe000e100,
    0x00171a3c,
    0xe000ed00,
    0x001732b4,
    0x40320084,
    0x40328040,
    0x001cfdb8,
    0x001cfdc8,
    0x001e4000,
    0x001cfde4,
    0x40501000,
    0x40044084,
    0x40506000,
    0x40044100,
    0x40580010,
    0x40580018,
    0x001cfdd0,
    0x001732a4,
    0x00171934,
    0x41f0e92d,
    0x46042302,
    0x21052206,
    0x4019f241,
    0xfd2af65e,
    0x23022206,
    0x21054606,
    0x4017f241,
    0xfd22f65e,
    0x80e0f8df,
    0x46054933,
    0x7080f44f,
    0xfb30f660,
    0xfe40f664,
    0xf64c4620,
    0x2700feed,
    0x006cf894,
    0x3024f8d8,
    0x70374798,
    0x3063f894,
    0x482a7073,
    0x010cf1a6,
    0xf99cf65f,
    0x3064f894,
    0xf894bb7b,
    0x2bff306c,
    0x2301d00d,
    0x22062100,
    0xf65e200c,
    0x4601fcf9,
    0x306cf894,
    0x390cf801,
    0xf65f481e,
    0x6c23f987,
    0x2301b16b,
    0x22062100,
    0xf65e2039,
    0x4601fce9,
    0x3063f894,
    0x390cf801,
    0xf65f4816,
    0x2300f977,
    0xf894702b,
    0x706b3063,
    0x010cf1a5,
    0xf65f4811,
    0xe8bdf96d,
    0xf66441f0,
    0x2206bf4b,
    0x46392304,
    0xf65e201e,
    0x7087fccd,
    0x3063f894,
    0xf1a070c3,
    0x4808010c,
    0xf95af65f,
    0x31d8f8d8,
    0x47984806,
    0x775f4b06,
    0xf4236863,
    0x60637380,
    0xbf00e7b5,
    0x001cfdf4,
    0x0017af08,
    0x001792c0,
    0x001792b4,
    0x00171a3c,
    0x43f0e92d,
    0x6cc56b43,
    0x1800f413,
    0x4604b083,
    0x0728f105,
    0xf403d008,
    0xf5b31360,
    0xf0001f20,
    0xb003808f,
    0x83f0e8bd,
    0x6d068dc3,
    0xd538071a,
    0x9240f8df,
    0x2000f8d9,
    0x2000f9b2,
    0xf2c02a00,
    0x6a7180c3,
    0x6a32b909,
    0x06186891,
    0xf894d509,
    0x2b003043,
    0x80d1f040,
    0x3045f894,
    0xf0402b00,
    0x6cf380d3,
    0x03f0f423,
    0x790b64f3,
    0xf01363b7,
    0xbf080f01,
    0x7800f44f,
    0xf8c62300,
    0x65338048,
    0x6e2a6aeb,
    0xf0436372,
    0x62eb0302,
    0xf6514620,
    0x6ce2fd93,
    0xf0436a53,
    0x62530310,
    0xe8bdb003,
    0x4b6e83f0,
    0x3428f8d3,
    0x6deb4798,
    0xf89464b3,
    0x496b202b,
    0x60a4f44f,
    0x1202fb00,
    0x2062f892,
    0xf894bb32,
    0x4967202c,
    0x1282eb02,
    0x02c2eb01,
    0x2124f8d2,
    0xd51b0692,
    0xf4128de2,
    0x6be25f00,
    0xbf146bd2,
    0x1200f3c2,
    0x02c0f3c2,
    0xf8d6b982,
    0xf8bcc024,
    0x04102000,
    0xd509b291,
    0x200ae9d6,
    0x010ef3c1,
    0x3a043804,
    0x1000f8ac,
    0x200ae9c6,
    0x8160f8df,
    0xf8d863b7,
    0x6d272000,
    0x2000f9b2,
    0xdb472a00,
    0xb90a6a7a,
    0x68926a3a,
    0x63c0f423,
    0x791264b3,
    0xbf5c07d2,
    0x7300f443,
    0xe79f64b3,
    0x6c866b83,
    0x22c2f3c3,
    0x63372a05,
    0xf403d10d,
    0x6cea63c0,
    0x6f80f5b3,
    0xf44fbf14,
    0xf44f3380,
    0xf4223300,
    0x431a3240,
    0xf10464ea,
    0xf64f0038,
    0xf8d4ff49,
    0x6ba2c04c,
    0xf8dc88b0,
    0x6de93024,
    0x6aea63ea,
    0x0408f040,
    0xf44180b4,
    0x6e2c60c0,
    0xf04262f4,
    0x64300202,
    0x0310f043,
    0x463962ea,
    0x7082f506,
    0xf8cc2234,
    0xb0033024,
    0x43f0e8bd,
    0xb8eef66f,
    0x2a006ce2,
    0x6a7ad03c,
    0xd1b52a00,
    0xb1926a3a,
    0xe7b06cb3,
    0x6a71b32d,
    0xf47f2900,
    0x6a32af3c,
    0x8de3b10a,
    0x4923e736,
    0xf2404823,
    0xf66012b9,
    0x6a32fb7f,
    0x491fe7f5,
    0xf240481f,
    0xf66012b9,
    0x6a3afb77,
    0x2220e7e4,
    0x91014620,
    0xffb8f669,
    0xe72c9901,
    0x91018922,
    0xf66b4620,
    0x9901f8d1,
    0x4914e725,
    0xf44f4815,
    0xf66072d9,
    0x6a71fb61,
    0xf8d9b9a9,
    0xf9b33000,
    0x2b003000,
    0xe7d8dbcf,
    0x72d9f44f,
    0x480d490b,
    0xfb52f660,
    0xb9426a7a,
    0x3000f8d8,
    0x3000f9b3,
    0xdbb72b00,
    0x8de3e7d1,
    0x6cb3e6f9,
    0xbf00e768,
    0x00171a3c,
    0x00177cb0,
    0x00176020,
    0x001cfe3c,
    0x001cfe28,
    0x001cfe08,
    0x001732b0,
    0x43f8e92d,
    0x4d6f4604,
    0xf44f486f,
    0xfb0666a4,
    0x19aff604,
    0xf65f4639,
    0x4b6cf84b,
    0x42ba6a1a,
    0x2200bf04,
    0xf44f621a,
    0xfb0363a4,
    0xf8935304,
    0x2b023062,
    0x809ef000,
    0xd0722b04,
    0x91a0f8df,
    0x81a8f8df,
    0xd0632b00,
    0x3012f899,
    0x2011f899,
    0x2b014413,
    0x495ed114,
    0x0008f8d9,
    0xc190f8df,
    0x2300e9d1,
    0x0310f023,
    0x431a604b,
    0x4b5a4959,
    0x2000f8cc,
    0xc038f8d0,
    0xf8c18f82,
    0x601ac000,
    0x0018f106,
    0x31d8f8d8,
    0x47984428,
    0x0028f106,
    0x31d8f8d8,
    0x47984428,
    0x63a4f44f,
    0x5304fb03,
    0x24c0f893,
    0xf44fbb4a,
    0xfb0363a4,
    0xf8935304,
    0xf65c0063,
    0x4b49fe19,
    0x42ba691a,
    0x2200bf04,
    0x2100611a,
    0x62a4f44f,
    0xf6404638,
    0xf44ffb27,
    0xfb0060a4,
    0xf8d85404,
    0x62e33450,
    0x237f2205,
    0x63274639,
    0x2062f884,
    0x3065f884,
    0x3066f884,
    0xe8bd483b,
    0xf65e43f8,
    0xf893bf8b,
    0x210104c1,
    0xf856f65c,
    0x3013f899,
    0xf8893b01,
    0xe7ca3013,
    0x2011f899,
    0x3012f899,
    0xb2d23a01,
    0x2011f889,
    0xf641e796,
    0x2800fab7,
    0xf8dfd137,
    0xf8df90b4,
    0xf89980bc,
    0xf44f0010,
    0xfb0363a4,
    0x685a5300,
    0xf0226c19,
    0x605a0280,
    0xf8d8b111,
    0x47983054,
    0x3012f899,
    0x481eb9e3,
    0x68424922,
    0xc090f8df,
    0x430a6001,
    0x2000f8cc,
    0xf89921ff,
    0xf8892011,
    0xe76d1010,
    0x9068f8df,
    0x3012f899,
    0xb2db3b01,
    0x3012f889,
    0xf899b1cb,
    0xf8df2011,
    0xe75f8060,
    0xf982f655,
    0x3012f899,
    0x2000e7e6,
    0xfa84f641,
    0x681a4b11,
    0xd5c005d2,
    0x7280f44f,
    0x2080f8c3,
    0x8f4ff3bf,
    0x8f6ff3bf,
    0xf655e7b7,
    0xf8dff993,
    0xe741802c,
    0x00177cb0,
    0x00177ca0,
    0x001792b4,
    0x00179130,
    0x40320020,
    0x40320024,
    0x00175f48,
    0x00177c98,
    0x3503858c,
    0xe000e100,
    0x00171a3c,
    0x40320060,
    0x41f0e92d,
    0xf8df4d32,
    0xf8d580e0,
    0xf89834d0,
    0x4e307d22,
    0xf8d84798,
    0xf64041bc,
    0xf8d5fce3,
    0x4798349c,
    0xf8d5492c,
    0x680b2488,
    0x7300f423,
    0x7920600b,
    0x79234790,
    0x302af886,
    0xf8867962,
    0x7b62202b,
    0x202cf886,
    0x892088e1,
    0x85328962,
    0x84b1b2ff,
    0xb9d384f0,
    0x34a0f8d5,
    0x8cf04798,
    0x34a4f8d5,
    0x4e1d4798,
    0x000cf994,
    0x333cf8d5,
    0xf8d54798,
    0xf50634d4,
    0x463061a4,
    0xf0174798,
    0xd00c0f0d,
    0x3254f8d5,
    0x41f0e8bd,
    0xf8d54718,
    0x479834a8,
    0xf8d58cf0,
    0x479834ac,
    0x07bbe7e3,
    0x4a0fd514,
    0x3180f8d8,
    0x480e6911,
    0x21e0f8d5,
    0x24056146,
    0xf5017744,
    0xf043511c,
    0xf8c80302,
    0x31103180,
    0x41f0e8bd,
    0x4710300c,
    0x81f0e8bd,
    0x00171a3c,
    0x00173198,
    0x4033b390,
    0x001e417c,
    0x40501000,
    0x001792b4,
    0x001e4000,
    0x735f6372,
    0x3d212073,
    0x4c554e20,
    0x0000004c,
    0x786e7772,
    0x65725f6c,
    0x5f746573,
    0x5f747665,
    0x63746170,
    0x000a0d68,
    0x61647075,
    0x25206574,
    0x25202c64,
    0x000a0d64,
    0x65736572,
    0x6f642074,
    0x0a0d656e,
    0x00000000,
    0x20676663,
    0x25206425,
    0x64252064,
    0x00000a0d,
    0x78253d74,
    0x00000a0d,
    0x20746f6e,
    0x74736170,
    0x6425203a,
    0x0d64252c,
    0x0000000a,
    0x73736170,
    0x6425203a,
    0x0d64252c,
    0x0000000a,
    0x656c6564,
    0x72206574,
    0x72756f65,
    0x0d736563,
    0x0000000a,
    0x5f6c7874,
    0x66667562,
    0x675f7265,
    0x74287465,
    0x73656478,
    0x21202963,
    0x554e203d,
    0x00004c4c,
    0x2d646874,
    0x7269663e,
    0x705f7473,
    0x705f6462,
    0x00007274,
    0x5f6c7874,
    0x66667562,
    0x6d5f7265,
    0x64686361,
    0x65675f72,
    0x00000074,
    0x635f6372,
    0x6b636568,
    0x7461705f,
    0x006863,

#endif
};

#define AON_PATCH_START_ADDR_U02    0x001E4D28
#define AON_PATCH_NUM_U02           0x001E4D2C
#define PATCH_STORE_ADDR_U02        0x001E6000
#define FW_PATCH_ADDR_U02           0x001CE000
#define AON_PATCH_START_ADDR_U03    0x001E4D28
#define AON_PATCH_NUM_U03           0x001E4D2C
#define PATCH_STORE_ADDR_U03        0x001E6000
#define FW_PATCH_ADDR_U03           0x001CF000

#define AON_PATCH_START_ADDRx(v)    MCAT(AON_PATCH_START_ADDR_U0, v)
#define AON_PATCH_START_ADDR        AON_PATCH_START_ADDRx(CFG_ROM_VER)
#define AON_PATCH_NUMx(v)           MCAT(AON_PATCH_NUM_U0, v)
#define AON_PATCH_NUM               AON_PATCH_NUMx(CFG_ROM_VER)
#define PATCH_STORE_ADDRx(v)        MCAT(PATCH_STORE_ADDR_U0, v)
#define PATCH_STORE_ADDR            PATCH_STORE_ADDRx(CFG_ROM_VER)
#define FW_PATCH_ADDRx(v)           MCAT(FW_PATCH_ADDR_U0, v)
#define FW_PATCH_ADDR               FW_PATCH_ADDRx(CFG_ROM_VER)

patch_tbl_array_t patch_tbl;
patch_tbl_array_t patch_tbl_func;
uint32_t *patch_func;
uint32_t patch_tbl_size;
uint32_t patch_tbl_func_size;
uint32_t patch_func_size;
uint32_t aon_patch_start_addr;
uint32_t aon_patch_num;
uint32_t patch_store_addr;
uint32_t fw_patch_addr;

void wifi_patch_prepare(void)
{
    #if (CFG_ROM_VER == 255)
    uint8_t chip_id = ChipIdGet(0);
    if (chip_id == 0x03) {
        patch_tbl               = VAR_WITH_VERx(patch_tbl, 2);
        patch_tbl_func          = VAR_WITH_VERx(patch_tbl_func, 2);
        patch_func              = VAR_WITH_VERx(patch_func, 2);
        patch_tbl_size          = sizeof(VAR_WITH_VERx(patch_tbl, 2)) / 4;
        patch_tbl_func_size     = sizeof(VAR_WITH_VERx(patch_tbl_func, 2)) / 4;
        patch_func_size         = sizeof(VAR_WITH_VERx(patch_func, 2)) / 4;
        aon_patch_start_addr    = AON_PATCH_START_ADDRx(2);
        aon_patch_num           = AON_PATCH_NUMx(2);
        patch_store_addr        = PATCH_STORE_ADDRx(2);
        fw_patch_addr           = FW_PATCH_ADDRx(2);
    } else if (chip_id == 0x07) {
        patch_tbl               = VAR_WITH_VERx(patch_tbl, 3);
        patch_tbl_func          = VAR_WITH_VERx(patch_tbl_func, 3);
        patch_func              = VAR_WITH_VERx(patch_func, 3);
        patch_tbl_size          = sizeof(VAR_WITH_VERx(patch_tbl, 3)) / 4;
        patch_tbl_func_size     = sizeof(VAR_WITH_VERx(patch_tbl_func, 3)) / 4;
        patch_func_size         = sizeof(VAR_WITH_VERx(patch_func, 3)) / 4;
        aon_patch_start_addr    = AON_PATCH_START_ADDRx(3);
        aon_patch_num           = AON_PATCH_NUMx(3);
        patch_store_addr        = PATCH_STORE_ADDRx(3);
        fw_patch_addr           = FW_PATCH_ADDRx(3);
    }
    #else
    patch_tbl               = VAR_WITH_VER(patch_tbl);
    patch_tbl_func          = VAR_WITH_VER(patch_tbl_func);
    patch_func              = VAR_WITH_VER(patch_func);
    patch_tbl_size          = sizeof(VAR_WITH_VER(patch_tbl)) / 4;
    patch_tbl_func_size     = sizeof(VAR_WITH_VER(patch_tbl_func)) / 4;
    patch_func_size         = sizeof(VAR_WITH_VER(patch_func)) / 4;
    aon_patch_start_addr    = AON_PATCH_START_ADDR;
    aon_patch_num           = AON_PATCH_NUM;
    patch_store_addr        = PATCH_STORE_ADDR;
    fw_patch_addr           = FW_PATCH_ADDR;
    #endif
}
